package cc.mrbird.febs.power.controller;


import cc.mrbird.febs.common.utils.R;
import cc.mrbird.febs.power.entity.AccountBindMenuInfo;
import cc.mrbird.febs.power.service.IAccountBindMenuInfoService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author MrBird
 */
@RestController
@RequestMapping("/power/account-bind-menu-info")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class AccountBindMenuInfoController {

    private final IAccountBindMenuInfoService iAccountBindMenuInfoService;

    /**
     * 新增账户ID绑定菜单ID
     * @param accountBindMenuInfo
     * @return
     */
    @PostMapping("/AccountBindMenuInfoAdd")
    public R AccountBindMenuInfoAdd(AccountBindMenuInfo accountBindMenuInfo) {
        return R.ok(iAccountBindMenuInfoService.save(accountBindMenuInfo));
    }

    /**
     * 修改账户ID绑定菜单ID
     * @param accountBindMenuInfo
     * @return
     */
    @PutMapping("/AccountBindMenuInfoEdit")
    public R AccountBindMenuInfoEdit(AccountBindMenuInfo accountBindMenuInfo) {
        return  R.ok(iAccountBindMenuInfoService.updateById(accountBindMenuInfo));
    }

    /**
     * 根据id删除记录
     * @param id
     * @return
     */
    @DeleteMapping("/{id}")
    public R AccountBindMenuInfoDel(@PathVariable Integer id) {
        return R.ok(iAccountBindMenuInfoService.removeById(id));
    }

}
